<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jstl/core">
<ui:composition>
	<f:loadBundle basename="mensagens" var="msg" />
	<c:if test="${empty rotulo}">
		<c:set var="rotulo" value="${msg[campo]}" />
	</c:if>
	<c:if test="${empty requerido}">
		<c:set var="requerido" value="false" />
	</c:if>
	<c:if test="${empty temRotulo}">
		<c:set var="temRotulo" value="true" />
	</c:if>
	<c:if test="${empty erroPopup}">
		<c:set var="erroPopup" value="true" />
	</c:if>
	<c:if test="${empty estiloRotulo}">
		<c:set var="estiloRotulo" value="${'estiloRotulo'}" />
	</c:if>
	<c:if test="${empty estiloCampo}">
		<c:set var="estiloCampo" value="${'estiloCampo'}" />
	</c:if>
	<c:if test="${empty rendered}">
		<c:set var="rendered" value="${true}" />
	</c:if>
	<c:if test="${empty maximoCaracteres}">
		<c:set var="maximoCaracteres" value="${'1000'}" />
	</c:if>
	<c:if test="${empty desabilitado}">
		<c:set var="desabilitado" value="${false}" />
	</c:if>
	<c:set var="campoAux" value="${entidade}"/>
	<c:set var="indice" value="${0}"/>
	<c:if test="${empty id}">
		<c:set var="idAux" value="${''}"/>
		<c:forEach var="cadeia" items="${fn:split(campo,'')}" varStatus="status">
			<c:if test="${cadeia == '.'}">
				<c:set var="campoAux" value="${campoAux[fn:substring(campo,indice,status.index - 1)]}"/>
				<c:set var="idAux" value="${idAux}${fn:substring(campo,indice,status.index - 1)}"/>
				<c:set var="indice" value="${status.index}"/>
			</c:if>
			<c:if test="${status.last}">
				<c:set var="idAux" value="${idAux}${fn:substring(campo,indice,status.index)}"/>
				<c:set var="campoAux" value="${campoAux[fn:substring(campo,indice,status.index)]}"/>
			</c:if>
		</c:forEach>
	</c:if>
	<c:if test="${!(empty id)}">
		<c:set var="idAux" value="${id}"/>
		<c:forEach var="cadeia" items="${fn:split(campo,'')}" varStatus="status">
			<c:if test="${cadeia == '.'}">
				<c:set var="campoAux" value="${campoAux[fn:substring(campo,indice,status.index - 1)]}"/>
				<c:set var="indice" value="${status.index}"/>
			</c:if>
			<c:if test="${status.last}">
				<c:set var="campoAux" value="${campoAux[fn:substring(campo,indice,status.index)]}"/>
			</c:if>
		</c:forEach>
	</c:if>
	<c:if test="#{temRotulo}">
		<h:panelGroup rendered="${rendered}">
			<c:if test="#{requerido}"><h:graphicImage value="/images/icons/asterisco.png" styleClass="imgRequerido"/></c:if>
	 		<h:outputLabel styleClass="#{estiloRotulo}" id="${idAux}Label" value="#{rotulo}:"/>
		</h:panelGroup>
	</c:if>
	<h:panelGroup rendered="${rendered}">
		<a4j:loadStyle src="resource:///cssjs/template.css" />
		<h:inputSecret styleClass="#{estiloCampo}" id="#{idAux}Input" value="#{campoAux}" required="${requerido}" label="#{rotulo}" style="width:#{largura}px;" maxlength="#{maximoCaracteres}" onkeyup="#{onkeyup}" disabled="${desabilitado}" onfocus="#{onfocus}">
	  		<ui:insert />
		</h:inputSecret>
		<c:if test="${!erroPopup}">
			&#160;
			<h:message id="${idAux}Error" style="color: red;" for="#{idAux}Input" />
		</c:if>
	</h:panelGroup>
</ui:composition>
</html>